import { browser, by, element } from 'protractor';

class EchoesAppPage {
  navigateTo() {
    return browser.get('/');
  }

  getTitle() {
    return browser.getTitle();
  }

  getTitleInput() {
    return element(by.css('input[formcontrolname=title]'));
  }

  getVideoResults() {
    return element.all(by.css('youtube-videos youtube-list .youtube-list-item'));
  }

  // getTalkText(index: number) {
  //   return this.getTalks().get(index).getText();
  // }
}

describe('Echoes App E2E tests', () => {
  let page: EchoesAppPage;

  beforeEach(() => {
    page = new EchoesAppPage();
    page.navigateTo();
  });


  it('should have a title', () => {
    const actual = page.getTitle();
    const expected = 'Echoes Player - Open Source Media Player for Youtube';
    expect(actual).toEqual(expected);
  });

  it('should show 50 video search results', () => {
    let actual = page.getVideoResults().count();
    let expected  = 50;
    expect(actual).toEqual(expected);
  });

  // it('should have <home>', () => {
  //   let subject = element(by.css('app home')).isPresent();
  //   let result  = true;
  //   expect(subject).toEqual(result);
  // });

  // it('should have buttons', () => {
  //   let subject = element(by.css('button')).getText();
  //   let result  = 'Submit Value';
  //   expect(subject).toEqual(result);
  // });

});
